//
//  WangyiTableViewCell.m
//  网易新闻段子
//
//  Created by 洛洛大人 on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "WangyiTableViewCell.h"
#import "ImageModel.h"
#import "GetHeightTools.h"

@interface WangyiTableViewCell()



@property(nonatomic, retain)UILabel *digestLabel;

@end

@implementation WangyiTableViewCell
-(void)dealloc{

    [_digestLabel release];
    [super dealloc];
    
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self) {
        self.backgroundColor = [UIColor colorWithRed:0.99 green:0.92 blue:0.94 alpha:1];
        
        self.digestLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.digestLabel];
        [self.digestLabel release];
        
        
     
        
        
    }
    return self;
    
}

-(void)layoutSubviews {
    [super layoutSubviews];
    CGFloat height = [GetHeightTools heightWith:self.cellModel.digest];
    self.digestLabel.frame = CGRectMake(10, 15, CGRectGetWidth(self.contentView.bounds) - 20, height);
    self.digestLabel.numberOfLines = 0;
    
  
    
 
}



- (void)setCellModel:(ImageModel *)cellModel
{
    if(_cellModel != cellModel) {
        
        [_cellModel release];
        _cellModel = [cellModel retain];
        
    }
    
    
    self.digestLabel.text = cellModel.digest;
}









@end
